import { config } from '../../config/index';
import { request } from '../../utils/request';

/** 获取点评分类列表 */
function mockFetchReviewsCategory() {
  const { delay } = require('../_utils/delay');
  const { getClassificationList } = require('../../model/classification');
  return delay().then(() => getClassificationList());
}

/** 获取点评分类列表 */
export function getCategoryList() {
  if (config.useMock) {
    return mockFetchReviewsCategory();
  }
  return request('groups').then(res => {
    return res;
  });
}